import java.util.Arrays;

public class Leet567 {
    public static void main(String[] args) {
        System.out.println(checkInclusion("adc","dcda"));
    }
    static public boolean checkInclusion(String s1, String s2) {
        int[] num = new int[26];
        for (int i = 0; i < s1.length(); i++) {
            num[s1.charAt(i)-'a']++;
        }
        for (int i = 0; i < s2.length()-s1.length()+1; i++) {
            String temp = s2.substring(i,i+s1.length());
            int[] num2 = new int[26];
            System.out.println(temp);
            for (int j = 0; j < s1.length(); j++) {
                num2[temp.charAt(j)-'a']++;
            }
            if (Arrays.equals(num, num2))
                return true;
        }
        return false;
    }
}
